import { createRouter, createWebHashHistory } from 'vue-router'
import HomeView from '../views/home/HomeView.vue'

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView,
      meta: {
        title: '以爱之名'
      }
    },
    {
      path: '/TimeLine',
      name: 'TimeLine',
      component: () => import('../views/TimeLine.vue'),
      meta: {
        title: '以爱之名-大事记'
      }
    },
    {
      path: '/webviews',
      name: 'webviews',
      component: () => import('../views/WebViews.vue'),
      meta: {
        title: '以爱之名'
      }
    },
    {
      path: '/YiMa',
      name: 'YiMa',
      component: () => import('../views/YiMa.vue'),
      meta: {
        title: '以爱之名-姨妈日历'
      }
    },
    {
      path: '/JigsawPuzzle',
      name: 'JigsawPuzzle',
      component: () => import('../views/JigsawPuzzle/index.vue'),
      meta: {
        title: '以爱之名-拼图'
      }
    }
  ]
})
router.beforeEach((to) => {
  if (to.meta.title) {
    document.title = to.meta.title
  }
})
export default router
